﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Twi.DataAccess.OutInterface
{
    /// <summary>
    /// 排序接口
    /// </summary>
    public interface ISort
    {
        /// <summary>
        /// Sort重复性判断
        /// </summary>
        /// <param name="tableName">表名称（如：TUsers）</param>
        /// <param name="sort">排序值</param>
        /// <param name="sortField">排序字段(default:FSort)</param>
        /// <returns></returns>
        bool ExistSort(string tableName, int? sort,string sortField="FSort");

        /// <summary>
        /// Sort重复性判断(用于编辑)
        /// </summary>
        /// <param name="tableName">表名称（如：TUsers）</param>
        /// <param name="sort">排序值</param>
        /// <param name="id">编辑记录的ID</param>
        /// <param name="sortField">排序字段(default:FSort)</param>
        /// <param name="idField">ID字段(default:FID)</param>
        /// <returns></returns>
        bool ExistEditSort(string tableName, int? sort, string id, string sortField="FSort", string idField="FID");

        /// <summary>
        /// Sort重复性判断(带字段筛选)
        /// </summary>
        /// <param name="tableName">表名称（如：TUsers）</param>
        /// <param name="sort">排序值</param>        
        /// <param name="filterField">筛选字段</param>
        /// <param name="filterFieldValue">筛选字段值</param>
        /// <param name="sortField">排序字段(default:FSort)</param>
        /// <returns></returns>
        bool ExistSort(string tableName, int? sort, string filterField, string filterFieldValue, string sortField="FSort");

        /// <summary>
        /// Sort重复性判断(用于编辑)(带字段筛选)
        /// </summary>
        /// <param name="tableName">表名称（如：TUsers）</param>
        /// <param name="sort">排序</param>
        /// <param name="id">编辑记录的ID</param>
        /// <param name="filterField">筛选字段</param>
        /// <param name="filterFieldValue">筛选字段值</param>
        /// <param name="sortField">排序字段(default:FSort)</param>
        /// <param name="idField">ID字段(default:FID)</param>
        /// <returns></returns>
        bool ExistEditSort(string tableName, int? sort, string id, string filterField, string filterFieldValue, string sortField="FSort",string idField="FID");

        /// <summary>
        /// 获取当前最大Sort
        /// </summary>
        /// <param name="tableName">表名称（如：TUsers）</param>
        /// <param name="sortField">排序字段(default:FSort)</param>
        /// <returns></returns>
        int GetMaxSort(string tableName, string sortField = "FSort");

        /// <summary>
        /// 获取当前最大Sort(带字段筛选)
        /// </summary>
        /// <param name="tableName">表名称（如：TUsers）</param>
        /// <param name="filterField">筛选字段</param>
        /// <param name="filterFieldValue">筛选字段值</param>
        /// <param name="sortField">排序字段(default:FSort)</param>
        /// <returns></returns>
        int GetMaxSort(string tableName, string filterField, string filterFieldValue, string sortField="FSort");
    }
}
